Skip to content

add pagination - #25

Merged
yamcodes merged 11 commits into
springfrom
8-add-pagination-to-contacts-list
Mar 16, 2026
Merged

add pagination #25
yamcodes merged 11 commits into
springfrom
8-add-pagination-to-contacts-list

Conversation

@yamcodes

@yamcodes yamcodes commented Mar 16, 2026

Copy link
Copy Markdown
Owner

Closes #8

Summary by CodeRabbit

  • New Features
    • Contacts list now supports pagination, searchable index view, and page controls; bulk delete and add-new contact flows available from the index.
  • Bug Fixes
    • Email validation error responses now include inline error styling for clearer feedback.
  • Refactor
    • Template fragments updated to accept contact lists and simplify URL/attribute handling.
  • Chores
    • Expanded sample contact dataset to include 28 example contacts.

@coderabbitai

coderabbitai Bot commented Mar 16, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@yamcodes has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 14 minutes and 9 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ab5a8ea1-94af-4052-937f-0ea1f150c390

📥 Commits

Reviewing files that changed from the base of the PR and between 30f084e and df355cc.

📒 Files selected for processing (7)
  • src/main/java/codes/yam/contacts/ContactController.java
  • src/main/java/codes/yam/contacts/ContactRepository.java
  • src/main/java/codes/yam/contacts/ContactService.java
  • src/main/resources/templates/contacts/index.html
  • src/main/resources/templates/contacts/list.html
  • src/main/resources/templates/fragments/contact-fields.html
  • src/main/resources/templates/fragments/contact-list-rows.html
📝 Walkthrough

Walkthrough

The data.sql file has been expanded to include a significantly larger initial dataset of contact records. The original single jane-doe entry is now accompanied by 28 additional contact records with unique identifiers, slugs, names, emails, and phone numbers, growing the seed dataset from 2 to 30 total contacts.

Changes

Cohort / File(s) Summary
Initial Contact Data Expansion
src/main/resources/data.sql
Expanded INSERT INTO contact statement from 2 rows (john-doe, jane-doe) to 30 rows, adding 28 new contact records (alice-smith through zane-hall and beyond). Each row includes unique id, slug, name, email, and phone values. No schema or syntax changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A burrow of contacts, so happy and neat,

From alice to zane, our dataset's complete!

Thirty dear friends in the database grow,

Our seeds are now plenty—let the tests flow! 🌱

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The pull request title 'add pagination' does not match the actual changes, which expand the contact data seed in data.sql with 28 new contact entries. Update the title to accurately reflect the main change, such as 'Add multiple new contact entries to data.sql for seeding' or 'Expand contact database seed with 28 additional entries'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 8-add-pagination-to-contacts-list
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@yamcodes
yamcodes marked this pull request as draft March 16, 2026 16:43
- Replace `list.html` with `index.html` to introduce pagination support in the contact list view.
- Update Thymeleaf template to use `Page` object for handling paginated contact data.
- Add navigation links for previous and next pages based on pagination state.
- Update `list` method in `ContactService` to support pagination with `Pageable`.
- Replace `search` and `findAll` methods with a consolidated `list` method.
- Improve `generateSlug` logic to sanitize slugs by removing invalid characters.
- Update `contacts` endpoint to accept `Pageable` and use `contactService.list` for data retrieval.
- Switch view template from `contacts/list` to `contacts/index` and rename model attribute to `contactPage`.
- Wrap email validation error messages in `<span class="error">` tags for frontend styling. contact list and improve email validation responses

- Add pagination support to `contacts` endpoint with `@PageableDefault`.
- Update
@yamcodes yamcodes changed the title Add multiple new contact entries to data.sql for seeding database add pagination Mar 16, 2026
… pagination logic for consistency with service changes
# Conflicts:
#	src/main/java/codes/yam/contacts/ContactRepository.java
#	src/main/resources/data.sql
#	src/main/resources/templates/contacts/list.html
…nd extract contact rows into reusable fragment
@yamcodes
yamcodes marked this pull request as ready for review March 16, 2026 17:58

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/main/resources/templates/contacts/index.html`:
- Around line 44-48: Pagination links drop the current page size so navigating
resets page length; update both th:href attributes for "Previous" and "Next" to
include the current size parameter (e.g. add , size=${size} or ,
size=${contactPage.size} depending on which template variable is used) alongside
the existing page, q and sort params so the page size is preserved when clicking
those links.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: df4ee776-ceb8-47bd-ac2b-d752bfe6bd15

📥 Commits

Reviewing files that changed from the base of the PR and between 30f084e and 31bab9f.

📒 Files selected for processing (7)
  • src/main/java/codes/yam/contacts/ContactController.java
  • src/main/java/codes/yam/contacts/ContactRepository.java
  • src/main/java/codes/yam/contacts/ContactService.java
  • src/main/resources/templates/contacts/index.html
  • src/main/resources/templates/contacts/list.html
  • src/main/resources/templates/fragments/contact-fields.html
  • src/main/resources/templates/fragments/contact-list-rows.html
💤 Files with no reviewable changes (1)
  • src/main/resources/templates/contacts/list.html

Comment thread src/main/resources/templates/contacts/index.html Outdated
@yamcodes
yamcodes merged commit ca103d6 into spring Mar 16, 2026
1 check passed
@yamcodes
yamcodes deleted the 8-add-pagination-to-contacts-list branch March 16, 2026 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant